package AddressService

import (
	"context"
	"gdshop-font-api-go/app/request/AddressReq"
	"gdshop-font-api-go/library/response"
	toolsDb "gdshop-font-api-go/library/tools/db"
	"github.com/gogf/gf/frame/g"
	"time"
)

func Del(ctx context.Context, parames *AddressReq.Del) *response.JsonResponse {
	_, err := toolsDb.GetUnSafaTableAddDeleteWhere(ctx, "member_address").Where(
		"id=? AND member_id=?",
		parames.Id,
		parames.MemberId,
	).Data(g.Map{
		"delete_at": time.Now().Unix(),
	}).Update()
	if err != nil {
		return response.FailByRequestMessage(nil, err.Error())
	}

	return response.SuccessByRequestMessage(nil, "删除成功")
}
